// 该文件负责连接数据库
const { Sequelize } = require("sequelize");

// 创建数据库连接
const sequelize = new Sequelize("mysite2", "root", "123456aa", {
    host: "localhost",
    dialect: 'mysql',
    logging: false
});

const startDB=async()=> {
    try {
        await sequelize.authenticate();
        console.log('数据库已建立起连接.');
    } catch (error) {
        console.error('Unable to connect to the database:', error);
    }
}
startDB()

// 向外暴露这个连接实例
module.exports = sequelize;
